package com.ll.blog.contant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;

import java.util.Objects;


public enum OrderEnum {
    IS_TOP(1,true),
    NOT_TOP(0,false)
    ;

    OrderEnum(Integer value, Boolean desc) {
        this.value = value;
        this.desc = desc;
    }

    public static OrderEnum getEnumByCode(Integer code){
        for (OrderEnum value : values()) {
            if (Objects.equals(value.value, code)){
                return value;
            }
        }
        return null;

    }

    @EnumValue
    private Integer value;
    @JsonValue
    private Boolean desc;
}
